<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>XIUMI connect</title>
    <style>
      html,
      body {
        padding: 0;
        margin: 0;
      }
      #xiumi {
        position: absolute;
        width: 100%;
        height: 100%;
        border: none;
        box-sizing: border-box;
      }
    </style>
  </head>
  <body>
    <!--引入秀米页面-->
    <iframe id="xiumi" src="//xiumi.us/studio/v5#/paper"></iframe>
    <!--引入秀米页面-->
    <script type="text/javascript" src="./internal.js"></script>
    <script>
      var xiumi = document.getElementById('xiumi')
      var xiumi_url = window.location.protocol + '//xiumi.us'
      xiumi.onload = function () {
        xiumi.contentWindow.postMessage('ready', xiumi_url)
      }
      document.addEventListener('mousewheel', function (event) {
        event.preventDefault()
        event.stopPropagation()
      })
      window.addEventListener(
        'message',
        function (event) {
          if (event.origin == xiumi_url) {
            editor.execCommand('insertHtml', event.data)
            editor.fireEvent('catchRemoteImage') //这个配置一定写，catchRemoteImage表示自定义上传方法名（注意：秀米编辑器导入百度编辑器的时候，图片文件不会自动上传到我们自己设置服务器，所以这一点一定要写上）
            dialog.close()
          }
        },
        false
      )
    </script>
  </body>
</html>
